home *** CD-ROM | disk | FTP | other *** search
/ Champak Vol C-14 / Vol C-14.iso / games / prototyp.swf / scripts / frame_8 / PlaceObject2_22_48 / CLIPACTIONRECORD onClipEvent(enterFrame).as < prev   
Text File  |  2012-04-23  |  778b  |  42 lines

  1. onClipEvent(enterFrame){
  2.    _root.speed = speed;
  3.    _root.mph = Number(speed) * 2;
  4.    _root.mph -= _root.mph % 1;
  5.    if(_root.mph < 1)
  6.    {
  7.       _root.mph = 1;
  8.    }
  9.    if(Key.isDown(38))
  10.    {
  11.       speed += 2;
  12.    }
  13.    if(Key.isDown(40))
  14.    {
  15.       speed -= 1;
  16.    }
  17.    if(Math.abs(speed) > 20)
  18.    {
  19.       speed *= 0.7;
  20.    }
  21.    if(Key.isDown(37))
  22.    {
  23.       _rotation = _rotation - 14;
  24.    }
  25.    if(Key.isDown(39))
  26.    {
  27.       _rotation = _rotation + 14;
  28.    }
  29.    speed *= 0.98;
  30.    x = Math.sin(_rotation * 0.017453292519943295) * speed;
  31.    y = Math.cos(_rotation * 0.017453292519943295) * speed * -1;
  32.    if(!_root.boundary.hitTest(_X + x,_Y + y,true))
  33.    {
  34.       _X = _X + x;
  35.       _Y = _Y + y;
  36.    }
  37.    else
  38.    {
  39.       speed *= -0.6;
  40.    }
  41. }
  42.